package com.windea.study.kotlin.game.tankwar2.model

import com.windea.study.kotlin.game.tankwar2.*
import com.windea.study.kotlin.game.tankwar2.core.*

/**爆炸物。*/
class Blast(
	override val x: Int,
	override val y: Int
) : Effect() {
	override val width: Int = GameConfig.block
	override val height: Int = GameConfig.block
	
	private val imagePaths = (1..32).map { "img/blast_${it}.png" }
	private var index: Int = 0
	
	override fun draw() {
		val i = index % imagePaths.size
		Painter.drawImage(imagePaths[i], x, y)
		index++
	}
	
	override fun isDestroyed(): Boolean {
		return index >= imagePaths.size
	}
}
